package com.xp.ai.chat.openai;

import dev.langchain4j.model.openai.OpenAiChatModel;
import dev.langchain4j.model.chat.ChatLanguageModel;
import dev.langchain4j.model.chat.request.ChatRequestParameters;

public class OpenAiSimpleChat {
    public static void main(String[] args) {
        ChatLanguageModel model = OpenAiChatModel.builder()
                .apiKey("demo")
                .defaultRequestParameters(ChatRequestParameters.builder()
                        .modelName("gpt-4o-mini")
                        .temperature(0.7)
                        .build())
                .build();
        String answer = model.chat("你是谁？");
        System.out.println("answer = " + answer);
        String msg2 = model.chat("请重复一遍");
        System.out.println("msg2 = " + msg2);
    }
}
